package com.motong.gongdan.vo.system.BOM.query;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Data
@ApiModel("物料清单列表请求参数")
@Accessors(chain = true)
public class BOMListQuery {

    @ApiModelProperty(value = "id")
    private Long id;

    @ApiModelProperty("属性ids(多个以,号隔开)")
    private String ids;

    @ApiModelProperty(value = "idList", hidden = true)
    private List<String> idList = new ArrayList<>();

    /*逗号分隔格式化为数组*/
    public void setIds(String ids) {
        if (StringUtils.hasLength(ids)) {
            idList.addAll(Arrays.asList(ids.split(",")));
        }
        this.ids = ids;
    }

    @ApiModelProperty(value = "父产品id")
    private Integer parentProductId;

    @ApiModelProperty(value = "多个父产品id")
    private List<Integer> parentProductIds;

    @ApiModelProperty(value = "子产品id")
    private Integer childProductId;

    @ApiModelProperty(value = "父产品编号")
    private String parentProductCode;

    @ApiModelProperty(value = "父产品名称")
    private String parentProductName;

    @ApiModelProperty(value = "父产品规格")
    private String parentProductSpecification;

    @ApiModelProperty(value = "子产品编号")
    private String childProductCode;

    @ApiModelProperty(value = "子产品名称")
    private String childProductName;

    @ApiModelProperty(value = "子产品规格")
    private String childProductSpecification;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "页码")
    private Integer page = 1;

    @ApiModelProperty(value = "条数")
    private Integer limit = -1;

}
